import 'package:flutter/material.dart';
import 'package:pax_info_app/repository/app_repository.dart';
import 'package:pax_info_app/ui/pages/login_page.dart';
import 'package:pax_info_app/utils/uidata.dart';

class MyAppbar extends StatelessWidget implements PreferredSizeWidget {
  final String title;
  MyAppbar(this.title);

  @override
  Widget build(BuildContext context) {
    return AppBar(
      backgroundColor: Color.fromRGBO(143, 148, 251, 1),
      title: Text(title),
      actions: [
        TextButton(
            onPressed: () {
              AppRepository.logout();
              Navigator.pushReplacement(
                  context, MaterialPageRoute(builder: (context) => LoginPage()));
            },
            child: Text('退出', style: TextStyle(color: UIData.white),))
      ],
    );
  }

  @override
  // TODO: implement preferredSize
  Size get preferredSize => throw UnimplementedError();
}